using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using QLKS.DataLayer.BusinessObjects;
using QLKS.DataLayer.Base;

namespace QLKS.DataLayer.ManagerObjects
{
    public partial interface IHoaDonManager : IManagerBase<HoaDon, string>
    {
		// Get Methods
		IList<HoaDon> GetByMaCTHoaDon(System.Int32 cTHoaDon);
		IList<HoaDon> GetByNguoiLap(System.String nhanVien1);
		IList<HoaDon> GetByNguoiCapNhat(System.String nhanVien2);
		IList<HoaDon> GetByTinhTrangID(System.Int32 tinhTrang);
    }

    partial class HoaDonManager : ManagerBase<HoaDon, string>, IHoaDonManager
    {
		#region Constructors
		
		public HoaDonManager() : base()
        {
        }
        public HoaDonManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<HoaDon> GetByMaCTHoaDon(System.Int32 cTHoaDon)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(HoaDon));
			
			
			ICriteria cTHoaDonCriteria = criteria.CreateCriteria("CTHoaDon");
            cTHoaDonCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", cTHoaDon));
			
			return criteria.List<HoaDon>();
        }
		
		public IList<HoaDon> GetByNguoiLap(System.String nhanVien1)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(HoaDon));
			
			
			ICriteria nhanVien1Criteria = criteria.CreateCriteria("NhanVien1");
            nhanVien1Criteria.Add(NHibernate.Criterion.Expression.Eq("Id", nhanVien1));
			
			return criteria.List<HoaDon>();
        }
		
		public IList<HoaDon> GetByNguoiCapNhat(System.String nhanVien2)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(HoaDon));
			
			
			ICriteria nhanVien2Criteria = criteria.CreateCriteria("NhanVien2");
            nhanVien2Criteria.Add(NHibernate.Criterion.Expression.Eq("Id", nhanVien2));
			
			return criteria.List<HoaDon>();
        }
		
		public IList<HoaDon> GetByTinhTrangID(System.Int32 tinhTrang)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(HoaDon));
			
			
			ICriteria tinhTrangCriteria = criteria.CreateCriteria("TinhTrang");
            tinhTrangCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", tinhTrang));
			
			return criteria.List<HoaDon>();
        }
		
		#endregion
    }
}